#include <iostream>
#include <algorithm>
using namespace std;

int const maxn = 1000010;
int da[maxn];
int n, c;

bool judge(int x)
{
	int num = 1, last = da[0];
	for (int i = 1; i < n; i++) {
		if (da[i]-last < x) continue;
		last = da[i];
		if (++num >= c) return true;
	}
	return false;
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> n >> c;
	for (int i = 0; i < n; i++) cin >> da[i];
	sort(da, da+n);
	int l = 1, r = da[n-1] - da[0];
	while (l + 1 < r) {
		int mid = (l+r)/2;
		if (judge(mid)) l = mid;
		else		    r = mid-1;
	}
	if (judge(r)) l = r;
	cout << l << "\n";
}

